package com.xinzhi.savingpot.search.controller;



import com.xinzhi.savingpot.search.service.impl.TaskInfoSolrServiceImpl;
import com.xinzhi.savingpot.search.vo.TaskInfoSolr;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.solr.client.solrj.SolrClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author astupidcoder
 * @since 2020-12-12
 */
@RestController
@RequestMapping("/solr")
@Api("solr查询")
public class TaskInfoSolrController {
    @Autowired
    private TaskInfoSolrServiceImpl taskInfoSolrService;


    /**
     * 查询所有数据
     * @return
     */

    @GetMapping("/queryAll")
    @ApiOperation("查询所有数据")
    public List<TaskInfoSolr> query(){
     return    taskInfoSolrService.queryAll();
    }

    /**
     *
     * @param keyword 通过关键字搜索，高亮
     * @return
     */

    @GetMapping("/searchGoodsByKeyword")
    @ApiOperation("通过关键字搜索")
    public List<TaskInfoSolr> searchKeyword(@RequestParam("keyword") String keyword){
        return taskInfoSolrService.searchGoodsByKeyword(keyword);
    }
}
